namespace Microsoft.VisualStudio.EnterpriseTools.OperationDesigner
{
    using Microsoft.VisualStudio.VirtualTreeGrid;
    using System;
    using System.ComponentModel;
    using System.Windows.Forms;

    public class OperationDesignerInPlaceEditCombo : TypeEditorHostListBox
    {
        public OperationDesignerInPlaceEditCombo(PropertyDescriptor descriptor, object instance) : base(null, descriptor, instance)
        {
        }

        protected internal OperationDesignerInPlaceEditCombo(TypeConverter converter, PropertyDescriptor propertyDescriptor, object instance) : base(converter, propertyDescriptor, instance)
        {
        }

        public OperationDesignerInPlaceEditCombo(TypeConverter converter, PropertyDescriptor propertyDescriptor, object instance, TypeEditorHostEditControlStyle editStyle) : base(converter, propertyDescriptor, instance, editStyle)
        {
        }

        protected override AccessibleObject CreateAccessibilityInstance()
        {
            base.EditAccessibleName = OperationDesignerInPlaceEdit.GetAccessibleObjectName(base.Parent as VirtualTreeControl);
            base.EditAccessibleDescription = OperationDesignerStrings.GetString("ComboAccDesc");
            return base.CreateAccessibilityInstance();
        }

        protected override void OnEditKeyDown(KeyEventArgs e)
        {
            OperationDesignerTreeControl control = base.Parent as OperationDesignerTreeControl;
            if (((control != null) && (e.KeyCode != Keys.Up)) && (e.KeyCode != Keys.Down))
            {
                e.Handled = ProcessKeyReturn.NotHandled != control.ProcessKeyDown(e);
            }
            if (!e.Handled)
            {
                base.OnEditKeyDown(e);
            }
        }

        protected override void OnEditKeyPress(KeyPressEventArgs e)
        {
            OperationDesignerTreeControl control2 = base.Parent as OperationDesignerTreeControl;
            if (control2 != null)
            {
                e.Handled = ProcessKeyReturn.NotHandled != control2.ProcessKeyPress(e.KeyChar, Control.ModifierKeys);
            }
            if (!e.Handled)
            {
                base.OnEditKeyPress(e);
            }
        }

        protected override void OnKeyDown(KeyEventArgs e)
        {
            OperationDesignerTreeControl control = base.Parent as OperationDesignerTreeControl;
            if (((control != null) && (e.KeyCode != Keys.Up)) && (e.KeyCode != Keys.Down))
            {
                e.Handled = ProcessKeyReturn.NotHandled != control.ProcessKeyDown(e);
            }
            if (!e.Handled)
            {
                base.OnKeyDown(e);
            }
        }

        protected override void OnKeyPress(KeyPressEventArgs e)
        {
            OperationDesignerTreeControl control2 = base.Parent as OperationDesignerTreeControl;
            if (control2 != null)
            {
                e.Handled = ProcessKeyReturn.NotHandled != control2.ProcessKeyPress(e.KeyChar, Control.ModifierKeys);
            }
            if (!e.Handled)
            {
                base.OnKeyPress(e);
            }
        }
    }
}

